package com.fqgj.xjd.user.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.xjd.user.dao.UserLevelInfoDao;
import com.fqgj.xjd.user.entity.UserLevelInfoEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
* User: frank
* Date: 2020-04-14
* Time: 11:42:44.972
*/

@Repository
public class UserLevelInfoDaoImpl extends AbstractBaseMapper<UserLevelInfoEntity> implements UserLevelInfoDao {

    @Override
    public UserLevelInfoEntity getUserLevelInfoByUserCode(String userCode) {
        Map<String, Object> param = new HashMap<>();
        param.put("userCode", userCode);
        return getSqlSession().selectOne(getStatement("getUserLevelInfoByUserCode"), param);
    }

    @Override
    public int updateUserLevelInfo(String userCode, Integer score, Integer reward, Integer usedReward) {
        Map<String, Object> param = new HashMap<>();
        param.put("userCode", userCode);
        param.put("score", score);
        param.put("reward", reward);
        param.put("usedReward", usedReward);
        return getSqlSession().update(getStatement("updateUserLevelInfo"), param);
    }
}